<!DOCTYPE html>
<html lang="en">

<head>
    <title></title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <block name="style">
        <link rel="stylesheet" href="__MYCSS__/main.min.css">
    </block>
</head>
<extend name="Public/base" />
<block name="body">

    <body>
        <ol class="breadcrumb">
            <li><a href="#">财务管理</a></li>
            <li class="active">备用金及欠票明细账</li>
        </ol>
        <p>
            <a class="btn btn-primary" role="button" data-toggle="collapse" href="#collapseExample" aria-expanded="false" aria-controls="collapseExample">查询</a>
            <button type="button" class="btn btn-default" data-toggle="modal" data-target="#addModal">添加</button>
        </p>
        <div class="collapse" id="collapseExample">
            <div class="well">
                <form method="GET" action="{:U('lst')}">
                    <div class="row">
                        <div class="col-lg-2">
                            <div class="form-group">
                                <label for="lb">类别：</label>
                                <select class="form-control " name="lb">
                                <option value="">--请选择--</option>
                                <volist name="lb_arr" id="lb">
                                    <option value="{$lb}">{$lb}</option>
                                </volist>
                            </select>
                            </div>
                        </div>
                        <div class="col-lg-1">
                            <div class="form-group">
                                <label for="year">所属年份：</label>
                                <select class="form-control father_select year_select" name="year">
                                <option value="">--请选择--</option>
                            </select>
                            </div>
                        </div>
                        <div class="col-lg-1">
                            <div class="form-group">
                                <label for="month">所属月份：</label>
                                <select class="form-control son_select month_select" name="month" disabled="disabled">
                                            <option value="">--请选择--</option>
                                        </select>
                            </div>
                        </div>
                        <div class="col-lg-2">
                            <div class="form-group" style="margin-top: 24px;">
                                <button type="submit" class="btn btn-success">查询</button>

                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>


        <div class="panel panel-default">
            <div class="panel-heading">资源成本明细表</div>

            <div class="surface_table">
                <div class="table-head">
                    <table class="table table-bordered">
                        <thead>
                            <tr class="table-h">
                                <th>类别</th>
                                <th>所属时间</th>
                                <th>付款账户</th>
                                <th>摘要</th>
                                <th>金额</th>
                                <th>借款人/欠票（单据）人</th>
                                <th>收款方</th>
                                <th>备注</th>
                                <th>操作</th>
                            </tr>
                        </thead>
                    </table>
                </div>
                <div class="table-body">
                    <table class="table table-hover table-bordered">
                        <tbody>
                            <volist name="lsts" id="list">
                                <tr>
                                    <td>{$list.lb}</td>
                                    <td>{$list.sssj}</td>
                                    <td>{$list.fkzh}</td>
                                    <td>{$list.zy}</td>
                                    <td class="count_je">{$list.je}</td>
                                    <td style="width:180px">{$list.jqr}</td>
                                    <td>{$list.skf}</td>
                                    <td>{$list.bz}</td>
                                    <td>
                                        <button type="button" data-id="{$list.id}" class="btn btn-warning update_btn" data-toggle="modal" data-target="#updateModal">修改</button>
                                        <a class="btn btn-danger delete_btn" href="{:U('del',array('id'=>$list['id']))}" role="button">删除</a>
                                    </td>
                                </tr>
                            </volist>
                            <tr>
                                <td colspan="4" style="text-align: center">总计</td>
                                <td id="count_je" class="count"></td>
                                <td colspan="4"></td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
        <!--添加面板-->
        <div class="modal fade bs-example-modal-lg" id="addModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
            <div class="modal-dialog modal-lg" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                        <h4 class="modal-title" id="myModalLabel">增加备用金及欠票明细</h4>
                    </div>
                    <div class="modal-body">
                        <form id="khzyForm" class="public_form" action="{:U('add')}" method="post">
                            <div class="row">
                                <div class="col-lg-4">
                                    <div class="form-group">
                                        <label for="addlb">类别</label>
                                        <input type="text" class="form-control" id="addlb" name="lb">
                                    </div>
                                </div>
                                <div class="col-lg-4">
                                    <div class="form-group">
                                        <label for="addsssj">所属时间</label>
                                        <input type="text" class="form-control form_date" value="" id="addsssj" name="sssj" data-date-format="yyyy-mm-dd" readonly>
                                    </div>
                                </div>
                                <div class="col-lg-4">
                                    <div class="form-group">
                                        <label for="addfkzh">付款账户</label>
                                        <input type="text" class="form-control" id="addfkzh" name="fkzh">
                                    </div>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-lg-4">
                                    <div class="form-group">
                                        <div class="form-group">
                                            <label for="addzy">摘要</label>
                                            <input type="text" class="form-control" id="addzy" name="zy">
                                        </div>
                                    </div>
                                </div>
                                <div class="col-lg-4">
                                    <div class="form-group">
                                        <label for="addje">金额</label>
                                        <input type="text" class="form-control" id="addje" name="je">

                                    </div>
                                </div>
                                <div class="col-lg-4">
                                    <div class="form-group">
                                        <label for="addjqr">借款人/欠票</label>
                                        <input type="text" class="form-control" id="addjqr" name="jqr">
                                    </div>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-lg-4">
                                    <div class="form-group">
                                        <label for="addskf">收款方</label>
                                        <input type="text" class="form-control" id="addskf" name="skf">
                                    </div>
                                </div>
                                <div class="col-lg-4">
                                    <div class="form-group">
                                        <label for="addbz">备注：</label>
                                        <textarea class="form-control" id="addbz" name="bz" rows="3" cols=""></textarea>
                                    </div>
                                </div>
                            </div>
                            <div class="modal-footer">
                                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                                <button type="submit" class="btn btn-primary">保存表单</button>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
        <!--修改面板-->
        <div class="modal fade bs-example-modal-lg" id="updateModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
            <div class="modal-dialog modal-lg" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                        <h4 class="modal-title" id="myModalLabel">修改备用金及欠票明细</h4>
                    </div>
                    <div class="modal-body">
                        <form id="khzyForm" class="public_form update_form" action="{:U('edit')}" method="post">
                            <div class="row">
                                <div class="col-lg-4">
                                    <div class="form-group">
                                        <label for="updatelb">类别</label>
                                        <input type="text" class="form-control" id="updatelb" name="lb">
                                    </div>
                                </div>
                                <div class="col-lg-4">
                                    <div class="form-group">
                                        <label for="updatesssj">所属时间</label>
                                        <input type="text" class="form-control form_date" value="" id="updatesssj" name="sssj" data-date-format="yyyy-mm-dd" readonly>
                                    </div>
                                </div>
                                <div class="col-lg-4">
                                    <div class="form-group">
                                        <label for="updatefkzh">付款账户</label>
                                        <input type="text" class="form-control" id="updatefkzh" name="fkzh">
                                    </div>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-lg-4">
                                    <div class="form-group">
                                        <div class="form-group">
                                            <label for="updatezy">摘要</label>
                                            <input type="text" class="form-control" id="updatezy" name="zy">
                                        </div>
                                    </div>
                                </div>
                                <div class="col-lg-4">
                                    <div class="form-group">
                                        <label for="updateje">金额</label>
                                        <input type="text" class="form-control" id="updateje" name="je">

                                    </div>
                                </div>
                                <div class="col-lg-4">
                                    <div class="form-group">
                                        <label for="updatejqr">借款人/欠票</label>
                                        <input type="text" class="form-control" id="updatejqr" name="jqr">
                                    </div>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-lg-4">
                                    <div class="form-group">
                                        <label for="updateskf">收款方</label>
                                        <input type="text" class="form-control" id="updateskf" name="skf">
                                    </div>
                                </div>
                                <div class="col-lg-4">
                                    <div class="form-group">
                                        <label for="updatebz">备注：</label>
                                        <textarea class="form-control" id="updatebz" name="bz" rows="3" cols=""></textarea>
                                    </div>
                                </div>
                            </div>
                            <input type="hidden" id="update_id" name="id">
                            <div class="modal-footer">
                                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                                <button type="submit" class="btn btn-primary">保存表单</button>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
            <script src="__MYJS__/main.min.js"></script>
            <script src="__MYJS__/main.js"></script>
            <script src="__MYJS__/validator.js"></script>
            <script src="__MYJS__/table.js"></script>
            <script>
                (function () {
                    // 修改按钮事件
                    $("table").on("click", ".update_btn", function (e) {
                        e.stopPropagation();
                        var id = $(this).attr("data-id");
                        $.ajax({
                            url: "{:U('edit')}",
                            type: 'GET', //GET
                            data: {
                                id: id
                            },
                            success: function (data) {
                                $(".update_form .form-control").each(function (index, val) {
                                    var self = this;
                                    for (x in data) {
                                        if ($(self).attr("name") == x) {
                                            $(self).val(data[x]);
                                        }
                                    }
                                });
                            }
                        })
                        $("#update_id").val(id);
                        $('#updateModal').modal();
                        // 重新更新日期选择器
                        $(".update_form .form_date").each(function (index, val) {
                            if ($(this).val() != "") {
                                $(this).val(moment($(this).val(), "YYYYMMDD").format("YYYY-MM-DD"))
                            }
                        })
                        $(".update_form .form_date").datetimepicker('update');
                    })
                    var zdytable = new window.zdytable();
                })()
            </script>


            <script>
            </script>
    </body>
</block>

</html>